<%@page contentType="text/html" import="java.sql.*"%>
<%@page pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 
<jsp:useBean id="event" scope="session" class="com.asaga.tools.Event_DBImpl" />
<jsp:useBean id="userProfile" scope="session" class="com.asaga.tools.SystemClient_DBImpl" />
<jsp:useBean id="location" scope="session" class="com.asaga.tools.Location_DBImpl" />
<jsp:useBean id="fontBean" scope="session" class="com.asaga.tools.FontBean" />
<jsp:setProperty name="fontBean" property="*" />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<% 
String username = (String)session.getAttribute("username");
if(username==null){
    response.sendRedirect("login.jsp?message=Please log in again.");
}
ResultSet allevents = event.getAllEvents();
ResultSet pastEvents = event.getPastEvents();
%>

<html>
    <%@ include file="header.jsp" %>
    <body>
        <div id="container">
            <%@ include file="topNav.jsp" %>
            <%@ include file="leftside.jsp" %>
            <%@ include file="rightside.jsp" %>
            <div id="content">             
                <h4 class="heading">Upcoming Events</h4><br />
                <%if(allevents == null){%>
                    No Events Listed
               <%}
                else{
                    while(allevents.next()){%>
                <div class="eventBlock">
                    <h4 class="sub_heading"><a href="AutismSiteMasterController?action=View Event&eventId=<%=allevents.getInt("eventID")%>">
                    <%=allevents.getString("event_title")%></a></h4>
                    <span class="eventListing"><%=allevents.getString("city")%>, <%=allevents.getString("state")%><br /><br />
                    <%=allevents.getString("description")%></span>
                </div>
                <%}
                 }%>
                <h4 class="heading">Past Events</h4><br />
                <%if(pastEvents == null){%>
                    No Events Listed
               <%}
                else{
                    while(pastEvents.next()){%>
                <div class="eventBlock">
                    <h4 class="sub_heading"><a href="AutismSiteMasterController?action=View Event&eventId=<%=pastEvents.getInt("eventID")%>">
                    <%=pastEvents.getString("event_title")%></a></h4>
                    <span class="eventListing"><%=pastEvents.getString("city")%>, <%=pastEvents.getString("state")%><br /><br />
                    <%=pastEvents.getString("description")%></span>
                </div>
                <%}
                 }%>
            </div>
            <%@ include file="footer.html" %>
        </div>        
    </body>
</html>
